import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:ct_pa_majordomo/pages/device/lock/fingerprint/widgets/expiration_date/index.dart";
import "package:ct_pa_majordomo/pages/device/entrance_guard/face/widgets/ope_record/index.dart";
import "package:ct_pa_majordomo/pages/widgets/menu_block.dart";
import "package:ct_pa_majordomo/widgets/button/index.dart";
import "package:ct_pa_majordomo/widgets/tai_dialog/index.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";

class Detail extends StatelessWidget {
  final Map info;
  const Detail({super.key, required this.info});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        iconTheme: const IconThemeData(color: Colors.white),
        title: const Text("人脸详情", style: TextStyle(color: Colors.white),),
        centerTitle: true,
        backgroundColor: ThemeVars.colorPrimaryDark,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios_new),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
      ),
      body: ListView(
        children: [
          MenuBlock(
            borderRadius: const BorderRadius.all(Radius.circular(0)),
            items: [
              MenuBlockItem(
                text: "人脸号",
                showArrow: false,
                suffix: const Text("4812536956582144", style: TextStyle(color: ThemeVars.colorTextTer),),
              ),
              MenuBlockItem(
                text: "姓名",
                showArrow: false,
                suffix: Text(info["name"], style: const TextStyle(color: ThemeVars.colorTextTer),),
              ),
              MenuBlockItem(
                text: "人脸",
                onTap: () {
                  taiDialog(
                    context: context,
                    child: Image.network(info["picUrl"]),
                  );
                },
              ),
              MenuBlockItem(
                  text: "有效期",
                  suffix: const Column(
                    children: [
                      Text("2024.09.02 20:50", style: TextStyle(color: ThemeVars.colorTextTer),),
                      Text("2024.09.03 20:50", style: TextStyle(color: ThemeVars.colorTextTer),),
                    ],
                  ),
                  onTap: () {
                    Navigator.push(
                      context,
                      CupertinoPageRoute(
                        builder: (BuildContext context) {
                          return const ExpirationDate();
                        },
                      ),
                    );
                  }
              )
            ],
          ),
          const SizedBox(height: 12,),
          MenuBlock(
            borderRadius: const BorderRadius.all(Radius.circular(0)),
            items: [
              MenuBlockItem(
                text: "添加者",
                showArrow: false,
                suffix: const Text("13023123123", style: TextStyle(color: ThemeVars.colorTextTer),),
              ),
              MenuBlockItem(
                text: "添加时间",
                showArrow: false,
                suffix: Text(info["createTime"] ?? "", style: TextStyle(color: ThemeVars.colorTextTer),),
              ),
            ],
          ),
          const SizedBox(height: 12,),
          MenuBlock(
            borderRadius: const BorderRadius.all(Radius.circular(0)),
            items: [
              MenuBlockItem(
                text: "操作记录",
                onTap: () {
                  Navigator.push(
                    context,
                    CupertinoPageRoute(
                      builder: (BuildContext context) {
                        return OpeRecord();
                      },
                    ),
                  );
                },
              ),
            ],
          ),
          Padding(
            padding: EdgeInsets.fromLTRB(ThemeVars.paddingPage, 40, ThemeVars.paddingPage, 0),
            child: Button(
              radius: 5,
              type: ButtonType.danger,
              onPressed: () {},
              child: const Text("删除"),
            ),
          ),
        ],
      ),
    );
  }

}